<%--
  Created by IntelliJ IDEA.
  User: admin666
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
  <title>Title</title>
  <style>
    *{
      user-select: none;
      /* 无法选中，整体感更强 */
    }

    body{
      background-image: url("./wallpaper.jpg");
      background-size: cover;
      background-attachment: fixed;
    }

    .login{
      position: absolute;
      top: 30%;
      margin-top: -200px;
      left: 50%;
      margin-left: -200px;
      /* absolute居中的一种方法 */
      background-color: whitesmoke;
      width: 400px;
      height: 600px;
      border-radius: 25px;
      text-align: center;
      padding: 5px 40px;
      box-sizing: border-box;
      /* 这样padding就不会影响大小 */
    }

    p{
      font-size: 42px;
      font-weight: 600;
    }

    input{
      background-color: whitesmoke;
      width: 100%;
      height: 48px;
      margin-bottom: 10px;
      border: none;
      border-bottom: 2px solid silver;
      /* 下面的会覆盖上面的步伐 */
      outline: none;
      font-size: 22px;
    }

    .btn{
      background-color: #59c2c5;
      width: 38%;
      height: 48px;
      border-radius: 8px;
      margin-top: 40px;
      font-size: 28px;
      font-weight: 600;
      color: white;
    }
    .btn:hover{
      background-color: #59c2a0;
    }
  </style>
</head>
<body>
<h1 style="text-align: center">注册页面</h1>
<div class="login">
  用户名: <input id="input1" type="text" name="username"/><br>
  密码: <input id="input2" type="password" name="password"/><br>
  电话: <input id="input3" type="text" name="phone"/><br>
  性别: <input id="input4" type="text" name="gender"/><br>
  邮箱: <input id="input5" type="email" name="eam"/><br>
  年龄: <input id="input6" type="text" name="age"/><br>
  <input class="btn" type="button" id="btn01" value="注册"> <br>
  <a href="/stadium/usermanagement_page/login.jsp">已经有账号了，点我登录</a>
</div>
<%--<form action="/glh/register" method="get">--%>


<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script>
  var student={};
  var arr=[];
  $(function(){
    $("#btn01").click(function(){
      var nm=$("#input1").val();
      var pw=$("#input2").val();
      var gd=$("#input4").val();
      var ph=$("#input3").val();
      var em=$("#input5").val();
      var ag=$("#input6").val();

      var user={"userAccount":nm,"userPassword":pw,"gender":gd,"phone":ph,"email":em,"age":ag};
      $.ajax({
        type:"post",
        url:"http://localhost:8080/stadium/glh/register",
        data:JSON.stringify(user),
        dataType:"json",
        success:function(data) {
          if(data != null)
          {
            window.location.href = "login_001.jsp";
          }
          if(data == null){
            alert("用户名重复");
          }
        }
      })
    })
  })
</script>
<body>


